<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //JSON  名称/值对的数据格式  JavaScript 语法的子集 key : value ,
        // 分两种写法 
        //  一  对象形式:
        console.log({'name':'king','age':18});
        //二 数组形式
        console.log([{'content':'只因你太美'},{'content':'man'}]);
        
        [
            {
                id: '1652038',
                attrsText: '规格：公道杯230ml/手工吹制',
                name: '共享品茶乐趣公道杯闻香杯手工吹制',
                price: '89.00',
                picture:
                    'https://yanxuan-item.nosdn.127.net/6aaff130c1d97c60f9931e00734bbad6.png',
                count: 10,
            },
            {
                id: '1096001',
                attrsText: '规格：不锈钢除味皂',
                name: '祛味除腥神器，不锈钢除味皂',
                price: '9.90',
                picture:
                    'https://yanxuan-item.nosdn.127.net/b38f9ac476ec494235f4aa80fc8e198c.png',
                count: 1,
            },
            {
                id: '3446012',
                attrsText: '颜色：芭比粉-老款',
                name: '一锅包揽煎烤蒸煮日本爱丽思多功能料理锅',
                price: '299.00',
                picture:
                    'https://yanxuan-item.nosdn.127.net/667dbc276e46e31b5a00869b9b1b8ef3.png',
                count: 2,
            },
            {
                id: '1652037',
                attrsText: '规格：黑白对杯',
                name: '茶水分离杯耐热隔热玻璃杯',
                price: '188.00',
                picture:
                    'https://yanxuan-item.nosdn.127.net/a09de222ed32efa8ffe359b1d5780574.jpg',
                count: 5,
            },
            {
                id: '3504000',
                name: '儿童防污/防蚊T恤110cm',
                attrsText: '颜色：白色草莓（防污） 尺码：160cm',
                price: '89.00',
                picture:
                    'https://yanxuan-item.nosdn.127.net/f899c55f36cb74232abb349234d9e676.png',
                count: 4,
            },
        ]
        //JSON对象
        let obj={
            'id':1000,
            'name':'大乔',
            'gender':'男',
            'age':18
        }
        // 2.序列化 JSON.parse() 转对象 JSON.stringify()  转字符串

        console.log(JSON.stringify(obj));
        console.log(typeof JSON.stringify(obj));
        let jsonstr='{"id":1000,"name":"大乔","gender":"男","age":18}'
        console.log(JSON.parse(jsonstr));
        
        localStorage.setItem('list',jsonstr)

        console.log(localStorage.setItem('list',jsonstr));
        
    </script>
</body>
</html>